package com.zzh.zzhaiagent.utils;

import jakarta.servlet.http.HttpServletRequest;

/**
 * @author 张 志 豪
 * @version 1.0
 * 判断邮箱是否正确
 */
public class RequestHeaderUtils {

    //获取请求头中的Authorization字段的token
    public static String getAuthorization(HttpServletRequest request) {
        if (request == null) {
            return null;
        }
        String authorization = request.getHeader("Authorization");
        if (authorization == null || authorization.isEmpty()) {
            return null;
        }
        if (authorization.startsWith("Bearer ")){
            return authorization.substring(7);//获取token
        }
        return null;
    }
}
